﻿using System;
using System.IO;
using System.Security;

class ConcatenateFiles
{
    static void Main()
    {
        try
        {
            using (StreamReader firstFile = new StreamReader("C:\\WINDOWS\\win.ini"))
            {
                using (StreamReader secondFile = new StreamReader("C:\\WINDOWS\\win.ini"))
                {
                    using (StreamWriter concatenatedFile = new StreamWriter("output.txt"))
                    {

                        string readFirst = firstFile.ReadToEnd();
                        string readSecond = secondFile.ReadToEnd();

                        concatenatedFile.Write(readFirst);
                        concatenatedFile.Write(readSecond);
                    }
                }
            }
        }
        catch (FileNotFoundException)
        {
            Console.WriteLine("Cannot find one/all of file(s)");
        }
        catch (DirectoryNotFoundException)
        {
            Console.WriteLine("Invalid Folder ");
        }
        catch (PathTooLongException)
        {
            Console.WriteLine("The path is too long");
        }
        catch (UnauthorizedAccessException)
        {
            Console.WriteLine("You don`t have access!");
        }
        catch (NotSupportedException)
        {
            Console.WriteLine("Cannot open this file!");
        }
        catch (SecurityException)
        {
            Console.WriteLine("Not enough permission to open file!");
        }
    }
}